---@class GT.poly_area 多边形区域
---@field poly_area PolyArea
GT.poly_area=class(GT.area,false)

---@class poly_area_data
---@field poly_area PolyArea

function GT.poly_area:ctor(data)
    self.poly_area=data.poly_area
    data.area=self.poly_area
    super(self,data)
end

--- 通过区域ID返回自定义多边形区域
---@param res_id AreaID 区域ID
---@return PolyArea
function GT.poly_area.get_polygon_area_by_res_id(res_id)
    ---@type poly_area_data
    local data = {
        poly_area = game_api.get_polygon_area_by_res_id(res_id)
    }
    return new(GT.poly_area, data)
end


--- 创建多边形区域
---@param point0 Point 点
---@param point1 Point 点
---@param point2 Point 点
---@param point3 Point 点
---@param point4 Point 点
---@param point5 Point 点
---@param point6 Point 点
---@param point7 Point 点
---@return GT.poly_area
function GT.poly_area.create_polygon_area(point0,point1,point2,point3,point4,point5,point6,point7)
    ---@type poly_area_data
    local data = {
        poly_area = game_api.create_polygon_area(point0,point1,point2,point3,point4,point5,point6,point7)
    }
    return new(GT.poly_area, data)
end

--- 创建多边形区域(新)
---@param point0 Point 点
---@param point1 Point 点
---@param point2 Point 点
---@param point3 Point 点
---@param point4 Point 点
---@param point5 Point 点
---@param point6 Point 点
---@param point7 Point 点
---@param point8 Point 点
---@param point9 Point 点
---@param point10 Point 点
---@param point11 Point 点
---@param point12 Point 点
---@return GT.poly_area
function GT.poly_area.create_polygon_area_new(point0,point1,point2,point3,point4,point5,point6,point7,point8,point9,point10,point11,point12)
    ---@type poly_area_data
    local data = {
        poly_area = game_api.create_polygon_area_new(point0,point1,point2,point3,point4,point5,point6,point7,point8,point9,point10,point11,point12)
    }
    return new(GT.poly_area, data)
end


--- 根据tag获取对应的不规则区域
---@return GT.poly_area
function  GT.poly_area.get_polygon_areas_by_tag(tag)
    ---@type poly_area_data
    local data = {
        poly_area = game_api.get_polygon_areas_by_tag(tag)
    }
    return new(GT.poly_area, data)

end


--- 点是否在不规则区域内
---@param point FPoint 点
---@return Bool
function GT.poly_area:judge_point_in_polygon_area(area)
    return game_api.judge_point_in_polygon_area(point,self.poly_area)
end


--- 不规则区域内单位数量
---@param area PolyArea 不规则区域
---@return UInt32
function GT.poly_area:get_unit_num_in_poly_area()
    return game_api.get_unit_num_in_poly_area(self.poly_area)
end

--- 不规则区域内所有未销毁单位
---@param area CirArea 不规则区域
---@return UnitGroup
function GT.poly_area:get_unit_group_in_poly_area()
    return game_api.get_unit_group_in_poly_area(self.poly_area)
end


--- 不规则区域内所有物品
---@return ItemGroup
function GT.poly_area:get_item_group_in_poly_area()
    return game_api.get_item_group_in_poly_area(self.poly_area)
end


--- 获取不规则区域顶点列表
---@return List
function GT.poly_area:get_poly_area_point_list()
    return game_api.get_poly_area_point_list(self.poly_area)
end



--- 设置多边形区域内视野情况
---@param player Role 玩家
---@param is_vision Bool 布尔变量
---@param is_vision_true Bool 布尔变量
---@return GT.poly_area
function GT.poly_area:set_poly_vision_visibility(player,is_vision,is_vision_true)
    game_api.set_poly_vision_visibility(self.poly_area,player,is_vision,is_vision_true)
    return self
end